package www.reagnetbox.com.scan;

import java.io.IOException;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * 通讯接口定义
 * Created by lgz on 17-4-17.
 */

abstract public class CommAbility{
	Lock lock = new ReentrantLock();
	public boolean isConnected;

	abstract public int sendData(byte[] data);

	abstract public int sendDataBlock(byte[] data, int timeOut);

	public void getLock(){
		lock.lock();
	}

	public void releaseLock(){
		lock.unlock();
	}

	abstract public byte[] recvDataLock(int timeOut);

	abstract public void open() throws IOException;

	abstract public void close() throws IOException;

}
